import os,pytest
from selenium import webdriver

@pytest.fixture(scope='function')
def getdriver():
    driver = None
    if 'edge' == os.getenv('browsertype'):
        driver = webdriver.Edge()
    elif 'chrome' == os.getenv('browsertype'):
        driver = webdriver.Chrome()
    elif 'firefox' == os.getenv('browsertype'):
        driver = webdriver.Firefox()

    if driver is None:
        print("未匹配到任何浏览器")
        return
    driver.maximize_window()
    driver.implicitly_wait(6)
    yield driver
    driver.quit()
